package com.common.exception;

import lombok.Getter;

import java.io.Serial;

@Getter
public class SeException extends RuntimeException {

    @Serial
    private static final long serialVersionUID = 1L;
    protected ErrCode ec;
    protected int code;

    public SeException(ErrCode ec) {
        super(ec.name()+ " >> " + ec.getMsg());
        this.ec = ec;
        this.code = ec.getCode();
    }

    public SeException(ErrCode ec, String msg) {
        super(ec.name() + " >> " + msg);
        this.ec = ec;
        this.code = ec.getCode();
        ErrCode.set(ec, msg);
    }
}
